<?php

class Form_DesignerForm extends Form_Custom_General {

    public function init() {

        $dsg_id = $this->createElement('hidden', 'dsg_id')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($dsg_id);

        $dsg_name = $this->createElement('text', 'dsg_name')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Name should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($dsg_name);

        $lgn_email = $this->createElement('text', 'lgn_email')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Email address should not be blank.')))
                ->addValidator(new Zend_Validate_EmailAddress())
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60"));
        $lgn_email->getValidator('emailAddress')->setMessage("Email address is not valid.", Zend_Validate_EmailAddress::INVALID_FORMAT);
        $this->addElement($lgn_email);

        $old_password = $this->createElement('password', 'old_password')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "20"));
        $this->addElement($old_password);

        $password = $this->createElement('password', 'dsg_password')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "20"));
        $this->addElement($password);

        $confirmpassword = $this->createElement('password', 'dsg_confirmpassword')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Password should not be blank.')))
                ->setAttribs(Array("size" => "20"));
        $this->addElement($confirmpassword);

        $dsg_joineddate = $this->createElement('text', 'dsg_joineddate')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Joining date should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "20"));
        $this->addElement($dsg_joineddate);

        $dsg_designation = $this->createElement('text', 'dsg_designation')
                #->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Designation should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($dsg_designation);

        $dsg_address = $this->createElement('textarea', 'dsg_address')
                #->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Address should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim()
                ))
                ->setAttribs(Array("size" => "60", "cols" => "50", "rows" => "10"));
        $this->addElement($dsg_address);

        $dsg_telephone = $this->createElement('text', 'dsg_telephone')
                #->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Telephone number should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($dsg_telephone);

        $dsg_mobile = $this->createElement('text', 'dsg_mobile')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Mobile number should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($dsg_mobile);

        $lgn_active = $this->createElement('select', 'lgn_active')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select status.')));
        $this->addElement($lgn_active);

        $submit = $this->createElement('submit', 'Save')
                ->setAttribs(Array('title' => "Save changes"));
        $this->addElement($submit);

        $reset = $this->createElement('reset', 'Reset')
                ->setAttribs(Array('title' => "Save changes and continue to edit"));
        $this->addElement($reset);
    }

}